﻿<?php
   	include_once "../funciones.php";
    $con=conectar();
    $fallo=false;
   try {
          $con->beginTransaction();

        foreach($_POST as $borrar => $valor){
            echo $borrar;
           $sql="DELETE FROM ESCUELAS WHERE OID_ESC = ".$borrar;
           echo $sql;
            $stmt = $con->prepare($sql);
           $stmt->execute();
           $stmt = $con->prepare("commit");
           $stmt->execute();
        }
   }catch(PDOException $e ) {
			echo "error: ".$e->GetMessage();
            $con->rollBack();
            header( 'Location: borrarEscuelas.php?exito=2');
            $fallo=true;
	}

    if($fallo==false)
        header( 'Location: borrarEscuelas.php?exito=1');



?>